<template>
  <div id="wrapper">
  <div id="menu">
    <el-menu
      default-active="1"
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-submenu index="1" v-for="(item) in menuList" v-bind:key="item.id">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>{{item.name}}</span>
        </template>

        <el-menu-item index="1-1-1" v-for="(item1) in item.childMenuList" v-bind:key="item1.id">
          {{item1.name}}
        </el-menu-item>

      </el-submenu>
    </el-menu>
  </div>
  <div id="main">
    <router-view to="/debt"></router-view>
  </div>
  </div>
</template>

<script>
import {mapState, mapMutations} from 'vuex'
import {MODULE_MAIN} from '../store/modules'
import {MUTATION_TYPE_GETMENULIST} from '../store/main'

export default {
  name: 'Main',
  computed: {
    ...mapState(MODULE_MAIN, {
      menuList: 'menuList'
    })
  },
  methods: {

    ...mapMutations(MODULE_MAIN, {
      getMenuList: MUTATION_TYPE_GETMENULIST
    })
  },
  created: function () {
    let that = this
    that.getMenuList()
  }
}
</script>

<style scoped>
  #menu{
    display: table-cell;
    width: 260px;
    height: 100%;
    background-color: #545c64;
    overflow: hidden;
  }
  #main{
    display: table-cell;
    height: 100%;
    background-color: #fff;
  }
  #wrapper{
    display: table;
    width: 100%;
    min-height: 100%;
  }
</style>
